use serde::{Deserialize, Serialize};
use std::{collections::HashMap, fmt::Debug};

mod gsearch;
pub use gsearch::*;

#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct FutureInfo{
    /// such as AP, rb, hc
    pub name: String,
    pub sub_futures: Vec<SubFutureInfo>,    
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct SubFutureInfo{
    /// 代码, AP510
    pub code: String,
    /// 服务器ip:port, 8.155.160.209:9994
    pub addr: String,        
}

#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct GlmRequestParam{
    pub model	:String,
    pub messages: Vec<GlmMessage>,
    pub temperature: f32,        
}

#[derive(Debug, Deserialize, Serialize, Clone, Default)]
pub struct GlmResponse{
    pub id:	String,
    pub created:	i32,
    pub model:	String,
    pub choices:Vec<GlmChoices>,
    pub usage:GlmUsage,
}

#[derive(Debug, Deserialize, Serialize, Clone, Default)]
pub struct GlmChoices{
    pub finish_reason: String,
    pub index: i32,
    pub message: GlmMessage,
}

#[derive(Debug, Deserialize, Serialize, Clone, Default)]
pub struct GlmMessage{
    pub content: String,
    pub role: String,
}

#[derive(Debug, Deserialize, Serialize, Clone, Default)]
pub struct GlmUsage{
    pub completion_tokens: i32,
    // pub promp_tokens: i32,
    pub total_tokens: i32,
}

#[derive(Default, Serialize, Deserialize, Debug, Clone)]
pub struct ChatHistory {  
    #[serde(default)]
    pub id: i32,
    #[serde(default)]
    pub question: String,    
    #[serde(default)]    
    pub timestamp: String,
    #[serde(default)]
    pub response: String,    
}
